﻿
@{
    ViewData["Title"] = "Safe";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<div id="divForm" style="margin:2px;padding:2px;">
    <el-form :model="form" label-width="200px"> 
        <el-row :gutter="24">
            <el-col :span="6">
                <el-form-item label="后台登录失败最大次数" required>
                    <el-input v-model="form.failedLoginTimes" type="number"  ></el-input>
                </el-form-item>
            </el-col>
        </el-row>
        <el-row :gutter="24">
            <el-col :span="24">
                <el-form-item label="允许访问后台的IP列表">
                    <el-input type="textarea" v-model="form.allowIp" :rows="5"></el-input>
                </el-form-item>
            </el-col>
        </el-row>
        <el-form-item>
            <el-button type="primary" @@click="SaveBaseSettings()" size="mini" v-show="pageButtons.includes('savesafesettings')">保存</el-button>
            <el-button @@click="Back()" size="mini">关闭</el-button>
        </el-form-item>
    </el-form>
</div>
<script>

    var vueProject = new Vue({
        el: '#divForm',
        data() {
            return {
                pageButtons: [],
                form: {
                    id: 0,
                    allowIp: "",
                    failedLoginTimes:""
                }
            }
        },
        created() {
            var _this = this;
            _this.GetBaseSettings();

            _this.$getMenuButtons();
        },
        methods: {
            GetBaseSettings() {
                var _this = this;
                _this.$get("@Url.Action("GetSafesettings", "Settings")" ).then((res) => {
                    _this.form = res;
                });
            },
            SaveBaseSettings() {
                var _this = this;
                _this.$post("@Url.Action("SaveBaseSafeSettings", "Settings")", _this.form).then((res) => {
                    _this.$success(res.message, function () {

                    });
                });
            },
            Back() {
                this.$back();
            }
        }
    });
</script>
